package com.rljk.common.controller;


import javax.servlet.http.HttpServletRequest;


import com.rljk.utils.SnowIdUtil;
import com.rljk.domain.common.PageData;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import org.springframework.web.servlet.ModelAndView;

import java.util.Map;


/**
 * @author 于泓磊
 * 修改时间：2017、10、22
 */
@Slf4j
public class BaseController {
	

	@SuppressWarnings("unused")
	private static final long serialVersionUID = 6357869213649815390L;
	
	/** new PageData对象
	 * @return
	 */
	public PageData getPageData(){
		return new PageData(this.getRequest());
	}
	
	/**得到ModelAndView
	 * @return
	 */
	public ModelAndView getModelAndView(){
		return new ModelAndView();
	}
	
	/**得到request对象
	 * @return
	 */
	public HttpServletRequest getRequest() {
		HttpServletRequest request = ((ServletRequestAttributes)RequestContextHolder.getRequestAttributes()).getRequest();
		return request;
	}

	/**得到32位的uuid
	 * @return
	 */
	public String getSnowId(){
		return SnowIdUtil.getSnowId();
	}
	
	
	public static void logBefore(String interfaceName){
		log.info("");
		log.info("start");
		log.info(interfaceName);
	}
	
	public static void logAfter(){
		log.info("end");
		log.info("");
	}
	
}
